package com.zr.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.ShowJianPriceDao;
import com.zr.model.CharTrap;
import com.zr.service.ShowJianPriceService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service("shjiprse")
public class ShowJianPriceServiceImpl implements ShowJianPriceService{
	@Resource
	private ShowJianPriceDao shjiprdi;
	@Override
	public JSONObject getJianPrice(int page, int rows) {
		JSONObject jo=new JSONObject();
		JSONArray ja=new JSONArray();
		List<CharTrap> li=shjiprdi.findJianPrice(page, rows);
		for (CharTrap charTrap : li) {
		
			JSONObject j=new JSONObject();
			j.put("tpid", charTrap.getTpid());
			j.put("disid1", charTrap.getCdisstationByDisid1().getDisname());
			j.put("disid2", charTrap.getCdisstationByDisid2().getDisname());
			j.put("tprice", charTrap.getTprice());
			j.put("fkgc", charTrap.getFkgc());
			j.put("subkilogramme", charTrap.getSubkilogramme());
			j.put("mtm", charTrap.getMtm());
			j.put("sta", charTrap.getSta());
			ja.add(j);
		}
		jo.put("rows", ja);
		jo.put("total", shjiprdi.getcoun());
		return jo;
	}

}
